package com.cssl.mapper;

import com.cssl.domain.*;
import com.cssl.domain.dto.GoodsDto;
import com.cssl.domain.dto.GoodsSearchDto;
import com.cssl.domain.dto.PageDto;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;


/**
 * dts_goods, dts_goods_attribute , dts_goods_product , dts_goods_specification (四和一)
 */
public interface DtsGoodsMapper {
    List<DtsGoods> findFirstPageGoods();

    List<DtsGoods> getTwoHotGoods();

    List<DtsGoods> getGoodsList(GoodsDto goodsDto);

    Integer getTotalGoodsCount();

    List<DtsGoods> getNewGoods();

    List<DtsGoods> getHotGoods();


    /**
     * 轮播图,相应的活动文字信息
     *
     * @return
     */
    List<DtsAd> findNoticeList();

    List<DtsArticle> getNotice(Integer id);

    List<GoodsAttrSpecification> getGoodsInfoById(int parseInt);


    DtsGoods getGoodsById(int parseInt);

    List<DtsComment> getGoodsCommentById(int parseInt);

    List<DtsGoodsSpecification> getGoodsSpecifications(int parseInt);

    List<DtsGoodsProduct> getGoodsProductById(int parseInt);

    List<Map> getGoodsBrandById(int parseInt);

    List<String> allGoodsKey();

    List<DtsHotKey> hotKey();

    List<DtsGoods> searchGoods(GoodsSearchDto searchDto);

    List<Map> getCategoryName(List<Integer> collect);

    List<DtsSearchHistory> historyKey(Integer uid);

    List<Integer> searchCategoryId(GoodsSearchDto searchDto);

    DtsGoodsProduct getCombination(Integer goodsId);

    List<DtsGoods> getGoodsByBrandId(Integer brandId);

    List<DtsGoods> getPageHotOrNewGoods(PageDto dto);

    List<DtsGoodsProduct> getRelevantData(@Param("goodsId") Integer goodsId, @Param("specificationsList") List<String> strings);

    /**
     * 团购优惠金额
     *
     * @param parseInt
     * @return
     */
    List<DtsGroupOnRules> getGoodsDiscount(int parseInt);

    List<Map> checkedSpecPrice(@Param("goodsId") Integer goodsId, @Param("specificationsList") List<String> strings);

    /**
     * 获取商品最后排序
     *
     * @return
     */
    Integer getGoodsLatSort();

    /**
     * 新增新商品
     *
     * @param goods
     * @return
     */
    Integer insertGoods(DtsGoods goods);

    /**
     * 将新商品编号同步成商品ID
     *
     * @return
     */
    Integer updateGoodsSn();

    /**
     * 获取新商品编号
     *
     * @return
     */
    Integer getNewGoodsSn();

    /**
     * 新增新商品属性
     *
     * @param goodsAttribute
     * @return
     */
    Integer insertGoodsAttribute(DtsGoodsAttribute goodsAttribute);

    /**
     * 新增新商品规格
     *
     * @param goodsSpecification
     * @return
     */
    Integer insertGoodsSpecification(DtsGoodsSpecification goodsSpecification);

    /**
     * 新增新商品货品
     *
     * @param goodsProduct
     * @return
     */
    Integer insertGoodsProduct(DtsGoodsProduct goodsProduct);

    List<DtsGoodsAttribute> getGoodsAttribute(int parseInt);

    List<DtsGoods> getGoodsRelated(@Param("categoryId") Integer id, @Param("goodsId") Integer goodsId);

    Integer getCateGoryIdByGoodsId(Integer id);

    List<DtsIssue> getAllIssueList(int parseInt);


    Map getCartInsertGoodsInfo(@Param("goodsId") Integer goodsId, @Param("list") List<String> strings);

    /**
     * 根据商品ID获取商品信息
     *
     * @param goodsId
     * @return
     */
    DtsGoods getDtsGoodsById(Integer goodsId);

    /**
     * 根据商品ID获取商品属性
     *
     * @param goodsId
     * @return
     */
    List<DtsGoodsAttribute> getGoodsAttributeByGoodsId(Integer goodsId);

    /**
     * 根据商品ID获取商品规格
     *
     * @param goodsId
     * @return
     */
    List<DtsGoodsSpecification> getGoodsSpecificationByGoodsId(Integer goodsId);

    /**
     * 根据商品ID获取商品货品
     *
     * @param goodsId
     * @return
     */
    List<DtsGoodsProduct> getGoodsProductByGoodsId(Integer goodsId);

    /**
     * 根据商品ID删除商品属性
     *
     * @param goodsId
     * @return
     */
    Integer deleteGoodsAttributeByGoodsId(Integer goodsId);

    /**
     * 根据商品ID删除商品规格
     *
     * @param goodsId
     * @return
     */
    Integer deleteGoodsSpecificationByGoodsId(Integer goodsId);

    /**
     * 根据商品ID删除商品货品
     *
     * @param goodsId
     * @return
     */
    Integer deleteGoodsProductByGoodsId(Integer goodsId);

    /**
     * 更新商品信息
     *
     * @param goods
     * @return
     */
    Integer updateGoods(DtsGoods goods);

    String getCommonGoods(@Param("strings") List<String> strings, @Param("goodsId") Integer goodsId, @Param("userId") Integer id);

    /**
     * 删除商品
     *
     * @param goodsId
     * @return
     */
    Integer deleteGoods(Integer goodsId);

    Double getOneGoodsInfo(@Param("goodsId") Integer goodsId, @Param("strings") List<String> list);

    Integer minusNumber(@Param("list") List<DtsCart> cartList);

    /**
     * 判断商品是否在订单中
     *
     * @param goodsId
     * @return
     */
    Integer goodsInOrder(Integer goodsId);

    List<Map> getGoodsBrandByUid(Integer userId);
}
